package com.ymttest.database.mongo;

import java.util.ArrayList;
import java.util.Map;

import com.ymt.database.MongoDBDriver;

/************************************************************************************
 * @File name :LiveProductInfoWapper.java
 * @Author : xujiewei
 * @Date : 2016年6月28日
 * @Copyright : 洋码头
 * 商品合库 新库
 ************************************************************************************/
public class ProductDescExtraWapper  {
	MongoDBDriver mdd = YmtMongoDriverFactroy.getInstance_YmtProductDBdriverNew("ProductDescExtra");

	public ProductDescExtraWapper()  {
	}
		

	@SuppressWarnings("unchecked")
	public Map<String,Object> getByProductId(String productId) throws Exception {
		@SuppressWarnings("rawtypes")
		ArrayList<Map> list = mdd.selectPartLimitToMap("{\"ProductId\":\"" + productId + "\"}",1);
	    
	    return list.size()>0?list.get(0):null;
	}
	
	public int getCountByProductId(String productId) throws Exception{
		return mdd.selectPartLimitToMap("{\"ProductId\":\"" + productId + "\"}",50).size();
	}
	
	
	public static void main(String[] args) throws Exception {
		
		Map<String,Object> a= new ProductDescExtraWapper().getByProductId("446ff746-fd90-4aad-a27c-1b53c81bcf29");
		System.out.println(a.get("DescText").toString());
		//Mongo
		
	}
	    
}
